package com.itheima.service.impl;


import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.itheima.mapper.ClassMapper;
import com.itheima.pojo.*;
import com.itheima.service.ClassService;

import org.springframework.stereotype.Service;

@Service
public class ClassServiceImpl extends ServiceImpl<ClassMapper,Clazz> implements ClassService {

//    @Autowired
//    private ClassMapper classMapper;
//    @Override
//    public PageResult classListInfo(ClassQueryParam classQueryParam) {
////         PageHelper.startPage(classQueryParam.getPage(),classQueryParam.getPageSize());
////        List<Clazz> list = classMapper.list(classQueryParam);
////        LocalDate now = LocalDate.now();
////        for (Clazz clazz : list) {
////           if( now.isBefore(clazz.getBeginDate())  ){
////               clazz.setStatus("未开班");
////           }else if( now.isAfter(clazz.getEndDate())  ){
////               clazz.setStatus("已结课");
////           }else {
////               clazz.setStatus("在读中");
////           }
////
////        }
////
////        Page<Clazz> pages =(Page<Clazz>) list;
////        long total = pages.getTotal();
////        List<Clazz> result = pages.getResult();
//        return null;
//    }
//
//    @Override
//    public List<Clazz> findAll() {
//        List<Clazz> clazzList =classMapper.listAll();
//        return clazzList;
//    }
//
//    @Override
//    public void save(Clazz clazz) {
//        clazz.setUpdateTime(LocalDateTime.now());
//        classMapper.add(clazz);
//    }
//
//    @Override
//    public Clazz getById(Integer id) {
//        Clazz clazz =classMapper.findById(id);
//        return clazz;
//    }
//
//    @Override
//    public void delById(Integer id) {
//        classMapper.delById(id);
//    }
//    @Override
//    public void updateById(Clazz clazz){
//        clazz.setUpdateTime(LocalDateTime.now());
//        classMapper.updateById(clazz);
//    }
}
